<template>
	<view class="mainpadding2" v-if="pageShow">
		<view class="mainpadding_top ffffff radius">
			<view class="titletext bold hei_text">订单商品</view>
			<view class="flexleft margin_top" v-if="type==1" @click="jumpdetail(type)">
				<image :src="dataAll.image_text" class="listleftimg radius" mode=""></image>
				<view class="flexcolumnbet margin_left2" style="height: 160rpx;">
					<view class="yihang hei_text bold main_size">{{dataAll.lesson_name}}</view>
					<view class="flexleft">
						<view class="viplable margin_right" v-show="dataAll.is_vip">vip</view>
						<view class="bianhao">编号：{{dataAll.id}}</view>
					</view>
					<view class="flexbetween" style="width: 100%;">
						<view class="flexleft">
							<image :src="dataAll.teacher.avatar" mode="" class="listheadimg"></image>
							<view class="xiaohei margin_left1">{{dataAll.teacher.username}}</view>
						</view>
						<view class="xiaohong">￥{{dataAll.pay_price}}</view>
					</view>
				</view>
			</view>
			<view class="margin_top" v-if="type!=1" @click="jumpdetail(type)">
				<view class="yihang hei_text bold main_size">{{dataAll.lesson_name}}</view>
				<view class="flexleft margin_top2">
					<view class="viplable margin_right" v-show="dataAll.is_vip">vip</view>
					<view class="bianhao">编号：{{dataAll.id}}</view>
				</view>
				<view class="flexbetween margin_top2" style="width: 100%;">
					<view class="flexleft">
						<image :src="dataAll.teacher.avatar" mode="" class="listheadimg"></image>
						<view class="xiaohei margin_left1">{{dataAll.teacher.username}}</view>
					</view>
					<view class="xiaohong">￥{{dataAll.pay_price}}</view>
				</view>
			</view>
		</view>
		<view class="ffffff mainpadding_top radius">
			<view class="flexbetween">
				<view class="main_size hei_text bold">订单编号</view>
				<view class="xiaohui">{{dataAll.order_no}}</view>
			</view>
			<view class="flexbetween margin_top">
				<view class="main_size hei_text bold">下单时间</view>
				<view class="xiaohui">{{dataAll.paytime_text}}</view>
			</view>
			<view class="flexbetween margin_top">
				<view class="main_size hei_text bold">支付方式</view>
				<view class="xiaohui">{{dataAll.pay_type==1?"微信支付":"余额支付"}}</view>
			</view>
		</view>
		<view class="flexright ffffff posibottom mainpadding">
			<view class="listbtnlan" v-if="dataAll.state==5" @click.stop="pingjia">立即评价</view>
			<view class="listbtnlan2 margin_left2" @click="jumpdetail(type)">立即查看</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				listid:"",
				type:1,//1优课,2辅导,3测试,4资料
				dataAll:{},
				pageShow:false
			}
		},
		onLoad(options) {
			this.type = options.type
			this.listid = options.id
		},
		onShow() {
			this.getDetail()
		},
		methods: {
			getDetail() {
				httpRequest.request('/api/lesson/getorderdetail', 'GET', {
					id: this.listid
				}, false, false, true).then(res => {
					if (res.code == 1) {
						this.dataAll = res.data
						this.pageShow = true
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			pingjia(){
				uni.navigateTo({
					url:'/pages_mine/fabiaopj?type='+this.type+"&id="+this.listid
				})
			},
			jumpdetail(type){
				let url = ""
				if(type==1){
					url = "/pages_index/youkexq?id="+this.dataAll.education_lesson_id
				}else if(type==2){
					url = "/pages_index/fudaoxq?id="+this.dataAll.education_lesson_id
				}else if(type==3){
					url = "/pages_index/ceshixq?id="+this.dataAll.education_lesson_id
				}else if(type==4){
					url = "/pages_index/ziliaoxq?id="+this.dataAll.education_lesson_id
				}
				uni.navigateTo({
					url
				})
			}
		}
	}
</script>

<style>

</style>
